home *** CD-ROM | disk | FTP | other *** search
- ; *******************************************************
- ; 3Dots
- ; by Don Finlay
- ; *******************************************************
- WBStartup
- ;
- Statement alert{text$}
- TextGadget 4,203,46,0,1,"O.K."
- Window 4,16,64,280,63,$1000,"We have a problem!",1,2,4
- WLocate 11,10
- Print text$
- Repeat
- ev4.l= WaitEvent
- Until ev4=$40 ;gadget released
- Free Window 4
- End Statement
- ;
- Screen 0,0,0,640,256,4,$8000,"Make 3D... Use menu to load picture",4,3
- LoadPalette 0,"title"
- Use Palette 0
- ;
- MenuTitle 0,0,"Project" ;set menue for screen 0
- MenuItem 0,0,0,0,"Load ","L"
- MenuItem 0,0,0,1,"Quit ","Q"
- ;
- MaxLen path$=192 ;must have this info before we use requester
- MaxLen name$=192
- ;
- Window 0,0,10,640,246,$1800,"",1,2
- LoadScreen 0,"title"
- SetMenu 0
- ;
- loop1:
- Repeat
- ev1.l=WaitEvent
- Select ev1.l
- Case 256 ;A menu event
- Select ItemHit
- Case 0 ;wants to load a pic
- p$=FileRequest$("File to Load",path$,name$)
- If p$="" ;no file selected
- Goto loop1
- EndIf
- Gosub loadpic ;open screen backdrop and menus
- Pop Select
- Case 1 ;get out of here!
- End
- End Select
- End Select
- Forever
- ;
- .loadpic:
- ILBMInfo p$
- d= ILBMDepth
- wide.l = ILBMWidth
- h.l= ILBMHeight
- ;
- If wide>320
- Then m=$8000 ;should this be m.l ?
- Else m=0
- EndIf
- ;
- If d>3 ;pic has more than 8 colors
- alert{"Picture has more than 8 colors"}
- Goto loop1
- EndIf
- If h>256 ;Interlace
- m=m+$4
- EndIf
- ;
- Screen 1,0,0,wide,h,d,m,"",0,1
- ;
- MenuTitle 1,0,"Project"
- MenuItem 1,0,0,0,"Make 3D"
- MenuItem 1,0,0,1,"Save Screen"
- MenuItem 1,0,0,2,"Print"
- MenuItem 1,0,0,3,"Quit"
- ;
- Window 1,0,0,wide,h,$1800,"",2,3 ;open backdrop to protect grafx
- SetMenu 1 ;attach menu to above window
- ;
- ScreensBitMap 1,1
- LoadPalette 1,p$ ;get pic palette
- Use Palette 1
- LoadScreen 1,p$ ;load pic
- Use Palette 1
- Free Window 0 ;Free up some memory
- Free Screen 0
- ;
- .main
- Repeat
- ev2.l=WaitEvent
- Select ev2.l
- Case 256 ;A menu event
- Select ItemHit
- Case 0 ; Make it
- Gosub Make3D
- Case 1 ;save it
- Gosub saveit
- Case 2
- Gosub printit
- Case 3 ; Quit
- Free Window 1
- Free Screen 1
- Pop Select
- End
- End Select
- End Select
- Forever
- ;
- .Make3D
- part = wide/8
- PalRGB 1,0,0,0,0 ;set color reg. 0 & 1 to black and white
- PalRGB 1,1,15,15,15 ;for re write of buffer to screen
- Use Palette 1
- ;
- Dim buff(wide+100) ;set up work area. Larger than scan
- ;line so that there is room to match
- ;pixels with those on right edge of
- ;screen
- ;
- For down = 0 To h
- For fill = 0 To wide ;fill buff with rnd 0 or 1
- buff(fill)= Rnd(Int(2))
- Next
- xpix = 0
- While xpix < wide
- col = Point(xpix,down)
- Select col
- Case 0
- same = part+7
- Case 1
- same = part+6
- Case 2
- same = part+5
- Case 3
- same = part+4
- Case 4
- same = part+3
- Case 5
- same = part+2
- Case 6
- same = part+1
- Case 7
- same = part
- End Select
- buff(xpix+same) = buff(xpix)
- xpix = xpix + 1
- Wend
- ;
- For newpic = 0 To wide
- Plot newpic,down,buff(newpic)
- Next
- Next
- Return
- ;
- .saveit
- MaxLen spath$=192 ;must have this info before we use requester
- MaxLen sname$=192
- loop2:
- ps$=FileRequest$("File to Load",spath$,sname$)
- If ps$ = "" Then Goto loop2
- SaveScreen 1,ps$
- Return
- ;
- .printit
- Hardcopy 1,0,0,wide,h,wide,h*4,$440
- Return
- ;
- End
-